import time

from selenium import webdriver
from selenium.webdriver.chrome.options import Options
from selenium.webdriver.common.by import By


class GetNewSystem():
    def __init__(self):
        self.get_url = "https://interactive.cponline.cnipa.gov.cn/public-app-zljffw/electronicPay/fillpayList/bank"

    def run(self):
        """ 登录中国及多国 """
        option = Options()
        option.add_experimental_option("detach", True)
        browser = webdriver.Chrome(chrome_options=option,
                                   executable_path=r'D:\python文件\chromedriver_win32\chromedriver.exe')
        browser.get(self.get_url)
        time.sleep(5)
        browser.find_element_by_xpath('//div[@class="el-radio-group title-group"]/label[3]').click()
        browser.find_element_by_xpath('//input[@type="text"]').clear()
        browser.find_element_by_xpath('//input[@type="text"]').send_keys('42264')
        time.sleep(2)
        browser.find_element_by_xpath('//input[@type="password"]').clear()
        browser.find_element_by_xpath('//input[@type="password"]').send_keys('Xhhg2019@')
        time.sleep(20)
        # 登录的时候需要手动去验证一下就好
        # browser.find_element_by_xpath('//div[@class="el-form-item__content"]/div[@class="gs-input el-input el-input--small el-input--suffix"]/input[@class="el-input__inner"]').send_keys("武汉信合红谷知识产权代理事务所（特殊普通合伙）")
        browser.find_elements(By.CLASS_NAME, "el-input__inner")[1].send_keys("武汉信合红谷知识产权代理事务所（特殊普通合伙）")
        browser.find_elements(By.CLASS_NAME, "el-input__inner")[2].send_keys("10070250000000026")
        time.sleep(1)
        # browser.find_elements(By.CLASS_NAME, "el-input__inner")[9].click()
        # browser.find_elements(By.CLASS_NAME, "el-input__inner")[4].send_keys("湖北省")
        # browser.find_elements(By.CLASS_NAME, "el-input__inner")[6].send_keys("武汉市")
        browser.find_elements(By.CLASS_NAME, "el-input__inner")[9].send_keys("湖北银行股份有限公司武汉江汉支行")
        # time.sleep(1)
        # browser.find_elements(By.CLASS_NAME, "el-select-dropdown__item")[-1].click()
        browser.find_elements(By.CLASS_NAME, "el-input__inner")[12].send_keys("15926306636")
        browser.find_elements(By.CLASS_NAME, "el-input__inner")[13].send_keys("522351242@qq.com")
        # browser.find_elements(By.CLASS_NAME, "el-input__inner")[14].send_keys("武汉代办处")


if __name__ == '__main__':
    GetNewSystem().run()
